﻿<UserControl x:Class="SinaDesktop.Controls.WindowControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" Width="72" Height="24">
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
        <HyperlinkButton x:Name="miniWindowsButton" Width="12" Margin="5,0,0,0" Height="12"
                         IsTabStop="False" Opacity="0.5" Click="miniWindowsButton_Click"
                         MouseEnter="HyperLinkButton_MouseEnter" MouseLeave="HyperLinkButton_MouseLeave" 
                         Style="{StaticResource WindowsControlHyperlinkButtonStyle}">
            <HyperlinkButton.Background>
                <ImageBrush ImageSource="/SinaDesktop;component/Images/miniButton.png" Stretch="None"/>
            </HyperlinkButton.Background>
            <ToolTipService.ToolTip>
                <ToolTip Margin="0,15,0,0" Content="迷你模式"/>
            </ToolTipService.ToolTip>
        </HyperlinkButton>

        <HyperlinkButton x:Name="regularButton" Width="12" Margin="5,0,0,0" 
                         Click="regularButton_Click" Visibility="Collapsed" IsTabStop="False" Opacity="0.5" 
                         MouseEnter="HyperLinkButton_MouseEnter" MouseLeave="HyperLinkButton_MouseLeave"
                         Style="{StaticResource WindowsControlHyperlinkButtonStyle}">
            <HyperlinkButton.Background>
                <ImageBrush ImageSource="/SinaDesktop;component/Images/maximizeButton.png" Stretch="None"/>
            </HyperlinkButton.Background>
            <ToolTipService.ToolTip>
                <ToolTip Margin="0,15,0,0" Content="正常模式"/>
            </ToolTipService.ToolTip>
        </HyperlinkButton>

        <HyperlinkButton x:Name="minimizeButton" Width="12" Margin="5,0,0,0" 
                         Click="minimizeButton_Click" IsTabStop="False" Opacity="0.5" 
                         MouseEnter="HyperLinkButton_MouseEnter" MouseLeave="HyperLinkButton_MouseLeave" 
                         Style="{StaticResource WindowsControlHyperlinkButtonStyle}">
            <HyperlinkButton.Background>
                <ImageBrush ImageSource="/SinaDesktop;component/Images/minimizeButton.png" Stretch="None"/>
            </HyperlinkButton.Background>
            <ToolTipService.ToolTip>
                <ToolTip Margin="0,15,0,0" Content="最小化"/>
            </ToolTipService.ToolTip>
        </HyperlinkButton>

        <HyperlinkButton x:Name="maximizeButton" Width="12" Margin="5,0,0,0" 
                         Click="maximizeButton_Click" IsTabStop="False" Opacity="0.5"  
                         MouseEnter="HyperLinkButton_MouseEnter" MouseLeave="HyperLinkButton_MouseLeave" 
                         Style="{StaticResource WindowsControlHyperlinkButtonStyle}">
            <HyperlinkButton.Background>
                <ImageBrush ImageSource="/SinaDesktop;component/Images/maximizeButton.png" Stretch="None"/>
            </HyperlinkButton.Background>
            <ToolTipService.ToolTip>
                <ToolTip Margin="0,15,0,0" Content="最大化"/>
            </ToolTipService.ToolTip>
        </HyperlinkButton>

        <HyperlinkButton x:Name="restoreButton" Width="12" Margin="5,0,0,0" 
                         Click="restoreButton_Click" Visibility="Collapsed" IsTabStop="False" Opacity="0.5" 
                         MouseEnter="HyperLinkButton_MouseEnter" MouseLeave="HyperLinkButton_MouseLeave"
                         Style="{StaticResource WindowsControlHyperlinkButtonStyle}">
            <HyperlinkButton.Background>
                <ImageBrush ImageSource="/SinaDesktop;component/Images/restoreButton.png" Stretch="None"/>
            </HyperlinkButton.Background>
            <ToolTipService.ToolTip>
                <ToolTip Margin="0,15,0,0" Content="恢复窗口"/>
            </ToolTipService.ToolTip>
        </HyperlinkButton>

        <HyperlinkButton x:Name="closeButton" Width="12" Margin="5,0,5,0" 
                         Click="closeButton_Click" IsTabStop="False" Opacity="0.5"  
                         MouseEnter="HyperLinkButton_MouseEnter" MouseLeave="HyperLinkButton_MouseLeave"
                         Style="{StaticResource WindowsControlHyperlinkButtonStyle}">
            <HyperlinkButton.Background>
                <ImageBrush ImageSource="/SinaDesktop;component/Images/closeButton.png" Stretch="None"/>
            </HyperlinkButton.Background>
            <ToolTipService.ToolTip>
                <ToolTip Margin="0,15,0,0" Content="关闭"/>
            </ToolTipService.ToolTip>
        </HyperlinkButton>
    </StackPanel>

    <!--<UserControl.Resources>
        <Style x:Key="ControlButtonStyle" TargetType="Button">
            <Setter Property="Background" Value="{StaticResource GrayBrush7}"/>
            <Setter Property="BorderBrush" Value="{StaticResource TextBoxBorderBrush}"/>
            <Setter Property="Foreground" Value="{StaticResource TextBrush}"/>
            <Setter Property="FontFamily" Value="{StaticResource ContentFontFamily}"/>
            <Setter Property="FontSize" Value="{StaticResource ContentFontSize}"/>
            <Setter Property="TextOptions.TextHintingMode" Value="Animated"/>
            <Setter Property="FontWeight" Value="SemiBold"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="BorderThickness" Value="0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Grid Width="16" Height="16">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="MouseOver">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="MouseOverBorder">
                                                <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Pressed">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="PressedBorder">
                                                <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="DisabledVisualElement">
                                                <SplineDoubleKeyFrame KeyTime="0" Value="0.7"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="contentPresenter">
                                                <EasingDoubleKeyFrame KeyTime="0" Value="0.3"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="FocusStates">
                                    <VisualState x:Name="Focused">
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="FocusRectangle">
                                                <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="FocusInnerRectangle">
                                                <EasingDoubleKeyFrame KeyTime="0" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>

                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Unfocused"/>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Border x:Name="Background" BorderThickness="{TemplateBinding BorderThickness}"/>
                            <Rectangle x:Name="DisabledVisualElement" Fill="{StaticResource ControlsDisabledBrush}" IsHitTestVisible="false" Opacity="0"/>
                            <Border x:Name="MouseOverBorder" BorderThickness="{TemplateBinding BorderThickness}" Opacity="0"/>
                            <Border x:Name="PressedBorder" BorderThickness="{TemplateBinding BorderThickness}" Opacity="0"/>
                            <Rectangle x:Name="FocusRectangle" Margin="-1" Opacity="0" Width="22" Height="22" />
                            <Rectangle x:Name="FocusInnerRectangle" StrokeThickness="{TemplateBinding BorderThickness}" Opacity="0" Width="20" Height="20" />
                            <ContentPresenter x:Name="contentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Opacity="0.5"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>

    <StackPanel x:Name="LayoutRoot" Orientation="Horizontal">
        <Button x:Name="btMinimize" Height="18" Width="18" Margin="0" Click="btMinimize_Click" Style="{StaticResource ControlButtonStyle}">
            <Image Width="16" Height="16" VerticalAlignment="Center" HorizontalAlignment="Center" Source="/SinaDesktop;component/Images/min.png" Stretch="None"/>
        </Button>
        <Button x:Name="btMaximize" Height="18" Width="18" Margin="0" Click="btMaximize_Click" Style="{StaticResource ControlButtonStyle}">
            <Image Width="16" Height="16" VerticalAlignment="Center" HorizontalAlignment="Center" Source="/SinaDesktop;component/Images/Maximize.png" Stretch="None"/>
        </Button>
        <Button x:Name="btClose" Height="18" Width="18" Margin="0" Click="btClose_Click" Style="{StaticResource ControlButtonStyle}">
            <Image Width="16" Height="16" VerticalAlignment="Center" HorizontalAlignment="Center" Source="/SinaDesktop;component/Images/Close.png" Stretch="None"/>
        </Button>
    </StackPanel>-->
</UserControl>
